package config;

import org.springframework.web.filter.CharacterEncodingFilter;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;

import javax.servlet.Filter;

public class WebApp extends AbstractAnnotationConfigDispatcherServletInitializer {

    @Override
    protected Class<?>[] getRootConfigClasses() {
        //包含了普通bean和从跟上下文继承了普通bean的多个WebApplicationContext
        return new Class[0];
    }

    @Override
    protected Class<?>[] getServletConfigClasses() {
        //在springmvc项目启以后，进行加载项目的配置信息
        return new Class[]{SpringMVCConfig.class};
    }

    @Override
    protected String[] getServletMappings() {
        //将所有的.do请求转给前端控制器
        return new String[]{"*.do"};
    }

    @Override
    protected Filter[] getServletFilters() {
        return new Filter[]{new CharacterEncodingFilter("UTF-8")};
    }
}
